package com.cloud.pole.user.biz.account;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ace.cache.annotation.Cache;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.account.UserAccountTypeMapper;
import com.cloud.pole.user.model.entity.account.UserAccountType;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

/**
 * ${DESCRIPTION}
 *
 * @author wanghaobin
 * @create 2017-06-08 16:23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserAccountTypeBiz extends BaseBiz<UserAccountTypeMapper, UserAccountType> {
	
	@Cache(key="userAccountType{1}")
    public UserAccountType selectByTypeId(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }
	
	public List<UserAccountType> selectAccountTypeValidList() {
		Example example = new Example(UserAccountType.class);
	    example.setOrderByClause("type_id");
	    Criteria criteria = example.createCriteria();
	    criteria.andEqualTo("typeStatus", 1);
		return selectByExample(example);
	}
}
